home *** CD-ROM | disk | FTP | other *** search
/ ...taking it to the Macs! / ...taking it to the Macs!.iso / Extras / ActiveX Mac SDK / ActiveX SDK / Sample Controls / Ticker / CTick.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-20  |  2.5 KB  |  90 lines  |  [TEXT/CWIE]

  1. #ifndef __CTick_h__
  2. #define __CTick_h__
  3.  
  4. #include <QuickDraw.h>
  5. #include <QDOffscreen.h>
  6. #include <deque.h>
  7.  
  8. /////////////////////////////////////////////////////////////////////////////
  9. //
  10. // Forward
  11. //
  12.  
  13. class CTickerControl;
  14. class CTickerError;
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. //
  18. // Macros & constants
  19. //
  20.  
  21. const short MAX_STR_NAME_LENGTH     = 254;    // because we use Str255s
  22. const short MAX_STR_VALUE_LENGTH     = 254;    // because we use Str255s
  23. const short NULLTERM = 1;                    // tack this on for null termination
  24.  
  25. const char UNINITIALIZED_TICK_NAME[]     = "";
  26. const char UNINITIALIZED_TICK_VALUE[]     = "";
  27.  
  28. typedef enum tagRenderState
  29. {
  30.     renderON,
  31.     renderOFF
  32. } RenderState;
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. //
  36. // CTick class definition
  37. //
  38.  
  39. class CTick
  40. {
  41. public:
  42.     CTick();
  43.     CTick( CTickerControl* pControl, long id ) ;
  44.     virtual ~CTick() ;
  45.     
  46. friend CTickerError;
  47.  
  48. public:
  49.     void Render(RenderState renderState);
  50.     void EraseImage(void);
  51.     BitMap * GetBitMap(void);
  52.     void ReleaseBitMap(void);
  53.     char * SetName(char * name);
  54.     char * SetValue(char * value);
  55.     char * GetName(void) { return mStrName; }
  56.     char * GetValue(void) { return mStrValue; }
  57.     short HSize(void) { return mSize.h; }
  58.     short VSize(void) { return mSize.v; }
  59.     void SetX(short x) { mXLocation = x; }
  60.     void BumpX(short x) { mXLocation += x; }
  61.     short GetX(void) { return mXLocation; }
  62.     void SetIsCached(Boolean isCached) { mCached = isCached; }
  63.     Boolean GetIsCached(void) { return mCached; }
  64.     void TruncateValue(short numberOfCharacters = 1);
  65.  
  66. protected:
  67.     void SetFontParams(void);
  68.     void SaveFontParams(void);
  69.     void ResetFontParams(void);
  70.     void GetTextSize(const StringPtr string, Point * textSize);
  71.     void InitFontInfo(void);
  72.  
  73. protected:
  74.     char *             mStrName;        // stock label buffer
  75.     char *             mStrValue;        // stock values buffer
  76.     CTickerControl* mControl;        // the CTickerControl we're associated with
  77.     FontInfo *        mFontInfo;        // font characterstics, for drawing
  78.     Rect             mBoundsRect;    // bounds of offscreen world
  79.     GWorldPtr        mGWorld;        // offscreen world
  80.     PixMapHandle    mPixMap;    // pixmap of offscreen world
  81.     Point            mSize;            // size of the (offscreen) world
  82.     long            mDataItemID;    // an index
  83.     short            mXLocation;            // coordinate; to the left of this is visible
  84.     Boolean            mCached;        // is this one cached?
  85.     RenderState        mRenderState;    // are we currenty rendered?
  86. };
  87.  
  88. /////////////////////////////////////////////////////////////////////////////
  89.  
  90. #endif // __CTick_h__